import axios from 'axios'

export interface StartProcessInstanceParams {
	name: string,

	key: string
}

export interface Instance {
	current: number

	pageSize: number
}

/**
 * 启动流程实例
 */
export function startProcessInstance(data: StartProcessInstanceParams) {
	return axios.post('/process-instance/start', data)
}

/**
 * 获取流程实例列表
 */
export function getProcessInstanceList(params: Instance) {
	return axios.get('/process-instance/list', { params })
}

/**
 * 挂起 / 激活流程实例
 */
export function suspendOrActivateProcessInstance(id: string) {
	return axios.put(`/process-instance/update-status/${id}`)
}

/**
 * 删除流程实例
 */
export function deleteProcessInstance(id: string) {
	return axios.delete(`/process-instance/delete/${id}`)
}